﻿using Microsoft.AspNetCore.Mvc;
using SportsPlatform.SmsVerification.ISmsVerification;
using SportsPlatform.Base;
using SportsPlatform.Query.SmsVerification;
using SportsPlatform.Dto.SmsVerification;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;

namespace SportsPlatform.Controllers
{
    /// <summary>
    /// 短信服务接口控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    public class SmsController : SportsPlatformControllerBase
    {
        private ISmsService _smsService;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="smsService"></param>
        public SmsController(ISmsService smsService)
        {
            _smsService = smsService;
        }

        /// <summary>
        /// 发送验证消息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymousAttribute]
        public async Task<ResultDto<SendMessageDto>> SendMessage([FromBody] SendMessageQuery query)
        {
            return await _smsService.SendMessage(query);
        }
    }
}
